package br.com.wryel.helper;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SecurityHelper {
	
	public static String toMD5(String valor) {
		try {
			MessageDigest messageDigest = MessageDigest.getInstance("MD5");
			BigInteger bigInteger = new BigInteger(1, messageDigest.digest(valor.getBytes()));
			return bigInteger.toString(16);
		} catch (NoSuchAlgorithmException e) {
			throw new HelperException("Erro ao criptografar String", e);
		}
	}
}
